<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>xlogdump</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2006-08-22T16:36:29"></HEAD
><BODY
CLASS="REFENTRY"
><H1
><A
NAME="APP-XLOGDUMP"
></A
>xlogdump</H1
> 

 <DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN6"
></A
>  <H2
>Name</H2
>xlogdump

  &nbsp;--&nbsp;   reads transaction log segments and outputs the operations within the file 
  
 </DIV
>

 <A
NAME="AEN9"
></A
>

 <DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN11"
></A
><H2
>Synopsis</H2
>  <P
>   <TT
CLASS="COMMAND"
>xlogdump</TT
>
    [<TT
CLASS="REPLACEABLE"
><I
>option</I
></TT
>]
    [<TT
CLASS="REPLACEABLE"
><I
>segment file</I
></TT
>]
  </P
>
 </DIV
>


 <DIV
CLASS="REFSECT1"
><A
NAME="xlogdump-description"
></A
>  <H2
>   Description
  </H2
>

  <P
>   <SPAN
CLASS="APPLICATION"
>xlogdump</SPAN
> is a utility for reading a 
   <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> transaction log segment or.
   set of segments. It can scan segment files without connection to
   a backend to simply return the raw data contained in  the files
   or it can be used with the backend that created the segments to
   translate the oids and output the names of the database objects.
  </P
>

 </DIV
>

 <DIV
CLASS="REFSECT1"
><A
NAME="xlogdump-options"
></A
>  <H2
>Options</H2
>

  <P
>    The following command-line options control the content and
    format of the output.

    <P
></P
></P><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="REPLACEABLE"
><I
>segments</I
></TT
></DT
><DD
>       <P
>        Specifies the name of the transaction log segment to be dumped. You can
        specifie more than one file, in wich case all of them will be scanned
	in the given order.
       </P
>
      </DD
><DT
><TT
CLASS="OPTION"
>-r  <TT
CLASS="REPLACEABLE"
><I
>operation</I
></TT
></TT
><BR><TT
CLASS="OPTION"
>--rmname  <TT
CLASS="REPLACEABLE"
><I
>operation</I
></TT
></TT
></DT
><DD
>       <P
>        Outuputs only the transaction log records containing the specified operation.
	The operations can be: 	XLOG, XACT, SMGR, CLOG, DBASE, TBSPC, MXACT, HEAP,
	BTREE, HASH, RTREE, GIST, SEQ.
       </P
>
      </DD
><DT
><TT
CLASS="OPTION"
>-t</TT
><BR><TT
CLASS="OPTION"
>--transactions</TT
></DT
><DD
>       <P
>        Outuputs only transaction info: the xid, total length and status
        of each transaction. The status can be COMMITED, ABORTED or NOT COMMITED for implicit aborts.
       </P
>
      </DD
><DT
><TT
CLASS="OPTION"
>-s</TT
><BR><TT
CLASS="OPTION"
>--statements</TT
></DT
><DD
>       <P
>        Tries to build fake statements that produce the physical changes found within the xlog segments.
	This works well for INSERT commands, for UPDATE and DELETE statements
	there's no way to rebuild the WHERE clause.
	To use this option you must have a connection to the database.
	(I know that requiring a connection to the database in this kind of program may seem silly,
	but this is still an alpha version.
	In the next version I'll use only the database files.)
       </P
>
      </DD
></DL
></DIV
><P>
   </P
>

   <P
>    The following command-line options control the database connection parameters.

    <P
></P
></P><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="OPTION"
>-h <TT
CLASS="REPLACEABLE"
><I
>host</I
></TT
></TT
><BR><TT
CLASS="OPTION"
>--host=<TT
CLASS="REPLACEABLE"
><I
>host</I
></TT
></TT
></DT
><DD
>       <P
>        Specifies the host name of the machine on which the server is
        running.  If the value begins with a slash, it is used as the
        directory for the Unix domain socket. The default is taken
        from the <TT
CLASS="ENVAR"
>PGHOST</TT
> environment variable, if set,
        else a Unix domain socket connection is attempted.
       </P
>
      </DD
><DT
><TT
CLASS="OPTION"
>-p <TT
CLASS="REPLACEABLE"
><I
>port</I
></TT
></TT
><BR><TT
CLASS="OPTION"
>--port=<TT
CLASS="REPLACEABLE"
><I
>port</I
></TT
></TT
></DT
><DD
>       <P
>        Specifies the TCP port or local Unix domain socket file
        extension on which the server is listening for connections.
        Defaults to the <TT
CLASS="ENVAR"
>PGPORT</TT
> environment variable, if
        set, or a compiled-in default.
       </P
>
      </DD
><DT
><TT
CLASS="OPTION"
>-U <TT
CLASS="REPLACEABLE"
><I
>username</I
></TT
></TT
></DT
><DD
>       <P
>        Connect as the given user, it must have access to all the databases in the cluster.
       </P
>
      </DD
></DL
></DIV
><P>
   </P
>
 </DIV
>

 <DIV
CLASS="REFSECT1"
><A
NAME="AEN83"
></A
>  <H2
>Environment</H2
>

  <P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="ENVAR"
>PGDATABASE</TT
><BR><TT
CLASS="ENVAR"
>PGHOST</TT
><BR><TT
CLASS="ENVAR"
>PGPORT</TT
><BR><TT
CLASS="ENVAR"
>PGUSER</TT
></DT
><DD
>     <P
>      Default connection parameters.
     </P
>
    </DD
></DL
></DIV
>
 </DIV
>

 <DIV
CLASS="REFSECT1"
><A
NAME="xlogdump-examples"
></A
>  <H2
>Examples</H2
>

  <P
>   To dump the contents of all segments in pg_xlog without a running backend:
</P><PRE
CLASS="SCREEN"
><SAMP
CLASS="PROMPT"
>$</SAMP
> <KBD
CLASS="USERINPUT"
>xlogdump $PGDATA/pg_xlog/*</KBD
></PRE
><P>
  </P
>

  <P
>   To get the status of all transaction in a database cluster:
</P><PRE
CLASS="SCREEN"
><SAMP
CLASS="PROMPT"
>$</SAMP
> <KBD
CLASS="USERINPUT"
>xlogdump -t $PGDATA/pg_xlog/*</KBD
></PRE
><P>
  </P
>

  <P
>   To dump the transaction logs using the object names:
   file:

</P><PRE
CLASS="SCREEN"
><SAMP
CLASS="PROMPT"
>$</SAMP
> <KBD
CLASS="USERINPUT"
>xlogdump -h localhost $PGDATA/pg_xlog/*</KBD
></PRE
><P>
  </P
>

 </DIV
>

 <DIV
CLASS="REFSECT1"
><A
NAME="AEN111"
></A
>  <H2
>See Also</H2
>

 </DIV
>&#13;</BODY
></HTML
>